aboutsummaryrefslogtreecommitdiff
path: root/src/pages/board/[board]/[tid].astro
blob: e9b345a1c64d710418f3991c40fb5761cc253fee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
import '../../../styles/thread.css';
import '../../../styles/blackbox.css';

import ThreadLayout from '../../../layouts/ThreadLayout.astro';
import Thread from '../../../components/Thread.astro'
import type Thread from '../../../models/Thread';;

import { api } from '../../../lib/api';
import { processThreadIn } from '../../../lib/thread';

const { board, tid } = Astro.params;
const data = await api('get', `thread/${board}/${tid}`);

if(data.status === 404) return Astro.redirect('/404');

const thread: Thread = await data.json();
await processThreadIn(board, thread, true);
---

<ThreadLayout>
  <h1 style="text-align:center">
    <a href=`/board/${board}`>{board}</a>
  </h1>

  <div class="blackbox">
    <button style="left: 50%; position: relative; transform: translate(-50%, 0);" onclick=`window.open('/create/${board}/${tid}','popUpWindow','height=500,width=600')`>
      Create Comment
    </button>
  </div>

  <Thread thread={thread} board={board} comments=true />
</ThreadLayout>